import { Body, Controller, Inject, Post, UseGuards } from '@nestjs/common';
import { NoteService } from './note.service';
import { CreateNoteDto } from './dto/create-note.dto';
import { UpdateNoteDto } from './dto/update-note.dto';
import { LoginGuard } from 'src/login.guard';

@Controller('note')
export class NoteController {
  @Inject(NoteService)
  private noteService: NoteService;

  @UseGuards(LoginGuard)
  @Post('createNote')
  createNote(@Body() createNoteDto: CreateNoteDto) {
    return this.noteService.createNote(createNoteDto);
  }

  @UseGuards(LoginGuard)
  @Post('updateNote')
  updateNote(@Body() updateNoteDto: UpdateNoteDto) {
    return this.noteService.updateNote(updateNoteDto);
  }

  @UseGuards(LoginGuard)
  @Post('deleteNote')
  deleteNote(@Body() query: { id: string }) {
    console.log(query, query.id);

    return this.noteService.deleteNote(query.id);
  }

  @UseGuards(LoginGuard)
  @Post('getNoteList')
  getNoteList(@Body() query: any) {
    return this.noteService.getNoteList(query);
  }

  @UseGuards(LoginGuard)
  @Post('getNoteDetails')
  getNoteDetails(@Body() query: { id: string }) {
    console.log(query);

    return this.noteService.getNoteDetails(query.id);
  }
}
